﻿<Window x:Class="AutoCorrelatorGUI.View.StatsColumnSelectView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:util="clr-namespace:Common.Utility;assembly=Common"
        xmlns:p="clr-namespace:AutoCorrelatorGUI.Properties"
        xmlns:ignore="http://www.ignore.com"
        mc:Ignorable="d ignore"
        Height="{Binding Source={x:Static p:Settings.Default}, Path=StatsColumnsWindowSize.Height, Mode=TwoWay}"
        Width="{Binding Source={x:Static p:Settings.Default}, Path=StatsColumnsWindowSize.Width, Mode=TwoWay}"
        Left="{Binding Source={x:Static p:Settings.Default}, Path=StatsColumnsWindowSize.Left, Mode=TwoWay}"
        Top="{Binding Source={x:Static p:Settings.Default}, Path=StatsColumnsWindowSize.Top, Mode=TwoWay}"
        DataContext="{Binding StatsColumnSelect, Source={StaticResource Locator}}" Title="Select Stats Columns To Display">

    <Window.Resources>
        <ResourceDictionary>
            <!-- Load this specific theme because the Aero theme for CheckBox has issues. -->
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/PresentationFramework.Royale;V3.0.0.0;31bf3856ad364e35;component\themes\royale.normalcolor.xaml" />
            </ResourceDictionary.MergedDictionaries>
            
            <Style x:Key="TreeViewItemStyle" TargetType="TreeViewItem">
                <Setter Property="IsExpanded" Value="{Binding Expanded, Mode=TwoWay}" />
                <Setter Property="IsSelected" Value="{Binding IsInitiallySelected, Mode=OneTime}" />
                <Setter Property="KeyboardNavigation.AcceptsReturn" Value="True" />
                <Setter Property="util:VirtualToggleButton.IsVirtualToggleButton" Value="True" />
                <Setter Property="util:VirtualToggleButton.IsChecked" Value="{Binding IsChecked}" />
            </Style>

            <HierarchicalDataTemplate x:Key="CheckBoxItemTemplate" ItemsSource="{Binding Children, Mode=OneTime}">
                <StackPanel Orientation="Horizontal">
                    <!-- These elements are bound to a FooViewModel object. -->
                    <CheckBox Focusable="False" IsChecked="{Binding IsChecked}" VerticalAlignment="Center"/>
                    <ContentPresenter Content="{Binding Header, Mode=OneTime}" Margin="2,0"/>
                </StackPanel>
            </HierarchicalDataTemplate>
        </ResourceDictionary>
    </Window.Resources>

    <Grid>
        <TreeView x:Name="tree" ItemContainerStyle="{StaticResource TreeViewItemStyle}" ItemsSource="{Binding StatsColumns}" ItemTemplate="{StaticResource CheckBoxItemTemplate}"/>
    </Grid>
</Window>
